import logging
import os

WORK_DIR = os.path.dirname(__file__)

def init_log():
    logger = logging.getLogger('eye_protector')
    logger.setLevel(logging.INFO)

    fh = logging.FileHandler('%s/eye_protector.log' % WORK_DIR, mode='w')
    fh.setLevel(logging.INFO)

    formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
    fh.setFormatter(formatter)

    logger.addHandler(fh)
    return logger

LOGGER = init_log()